<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="./../template/WorkspaceTemplate.xhtml">

    <ui:define name="top">

    </ui:define>

    <ui:define name="left">

    </ui:define>

    <ui:define name="right">

    </ui:define>

    <ui:define name="content">

        <h:form id="storeReceiptForm" style="font-size: 85%">
            <h2>Store Supplier Receipt</h2>
            <br/>
            <p:panel>
                <p:messages />
                <br/>
                <h:panelGrid columns ="4" cellpadding="10">
                    <h:outputLabel value="Receipt Number: " style="font-weight: bold"/>
                    <p:inputText value="#{srManagerBean.receipt.supplierReceiptNo}" required="true" requiredMessage="Receipt number cannot be empty"/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    
                    <h:outputLabel value="Supplier Invoice No: " style="font-weight: bold"/>
                    <p:inputText value="#{srManagerBean.supplierInvoiceNo}" required="true" requiredMessage="Supplier Invoice No cannot be empty"/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    
                    <h:outputLabel value="Receipt Amount: " style="font-weight: bold"/>
                    <p:inputText value="#{srManagerBean.receipt.receiptAmount}" required="true" requiredMessage="Receipt amount cannot be empty"/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    
                    <h:outputLabel value="Upload Supplier Receipt File: " style="font-weight: bold"/>
                    <h:inputText value="#{srManagerBean.receipt.uploadedImage.title}" disabled="true"/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    
                    <h:outputText value=""/>
                    <p:fileUpload update="storeReceiptForm" 
                                  fileUploadListener="#{srManagerBean.handleFileUploadSupplierReceipt}"
                                  widgetVar="uploader"
                                  cancelImage="/images/cancel.png" customUI="true"
                                  sizeLimit="2097152" width="180"
                                  label="Upload" 
                                  allowTypes="*.jpg;*.png;*.gif" 
                                  description="Images"/>  
                    <p:commandButton image="ui-icon ui-icon-arrowreturnthick-1-n" oncomplete="uploader.upload()"/>
                </h:panelGrid>
            </p:panel>

            <br/>
            <br/>
            <div align="right">
                <p:commandButton value="Create Supplier Receipt" action="#{srManagerBean.saveReceipt()}" image="ui-icon ui-icon-disk" update="storeReceiptForm"/>
            </div>
        </h:form>

    </ui:define>

    <ui:define name="bottom">

    </ui:define>

</ui:composition>
